<template>
  <div class="box" v-for="item in list.rows.disease">
    <div class="navBox">
      <h2>{{ item.name }}</h2>
      <p style="color: #ababab;">就诊科室：{{ item.medicalDepartment
        }}</p>
      <div class="iconBox">
        <div @click="active = 1">
          <comIcon v-if="active == 1" name="icons-home-科室简介" />
          <comIcon v-else name="icons-home-科室介绍" />
          <p :style="{ color: (active == 1 ? '#22c5a7' : '') }">简介</p>
        </div>
        <div @click="active = 2">
          <comIcon v-if="active == 2" name="icons-home-症状表现" />
          <comIcon v-else name="icons-home-症状表现 (1)" />
          <p :style="{ color: (active == 2 ? '#22c5a7' : '') }">症状</p>
        </div>
        <div @click="active = 3">
          <comIcon v-if="active == 3" name="icons-home-症状表现" />
          <comIcon v-else name="icons-home-症状表现 (1)" />
          <p :style="{ color: (active == 3 ? '#22c5a7' : '') }">诊断</p>
        </div>
        <div @click="active = 4">
          <comIcon v-if="active == 4" name="icons-home-异地就医" />
          <comIcon v-else name="icons-home-异地就医 (1)" />
          <p :style="{ color: (active == 4 ? '#22c5a7' : '') }">就医</p>
        </div>
        <div @click="active = 5">
          <comIcon v-if="active == 5" name="icons-home-治疗2" />
          <comIcon v-else name="icons-home-治疗3" />
          <p :style="{ color: (active == 5 ? '#22c5a7' : '') }">治疗</p>
        </div>
      </div>
      <div v-if="active == 1" class="textBoxs" v-html="item.introduction"> </div>
      <div v-if="active == 2" class="textBoxs" v-html="item.symptom"> </div>
      <div v-if="active == 3" class="textBoxs" v-html="item.diagnosis"> </div>
      <div v-if="active == 4" class="textBoxs" v-html="item.medicalConsult"> </div>
      <div v-if="active == 5" class="textBoxs" v-html="item.treatment"> </div>
      <div class="butBox">
        查看详情<van-icon name="arrow" />
      </div>

    </div>
  </div>
</template>

<script setup lang="ts">
import comIcon from '@/components/common/com-icon/com-icon.vue'
import type { rowss } from '@/types/types';
import { ref } from "vue"

const props = defineProps<{
  list: rowss
}>()
console.log(props.list);


const active = ref(1)
</script>

<style scoped lang="scss">
.box {
  width: 100%;
  background-color: #fafafa;
  padding: 15px 0;

  .navBox {
    width: 90%;

    margin: auto;
    background-color: rgb(255, 255, 255);
    border-radius: 20px;
    padding: 5px;
    line-height: 10px;
  }

  .iconBox {
    width: 100%;
    font-size: 30px;
    text-align: center;
    display: flex;

    p {
      font-size: 14px;
    }

    div {
      flex: 1;
      text-align: center;
    }
  }

  .textBoxs {
    width: 100%;
    height: 48px;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    border-bottom: 1px solid #f7f7f7;
    -webkit-box-orient: vertical;

    p {
      padding: 0;
      margin: 0;
    }
  }

  .butBox {
    width: 100%;
    height: 50px;
    line-height: 45px;
    text-align: center;
    border-top: 1px solid #edecec;
    margin-top: 20px;
  }
}
</style>
